<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>

    <link type="text/css" rel="stylesheet" href="../Public/css/reset.css">
    <link type="text/css" rel="stylesheet" href="../Public/css/DateTimePicker.css">
    <link type="text/css" rel="stylesheet" href="../Public/css/style.css">
    <script type="text/javascript" src="../Public/script/jquery.js"></script>
    <script type="text/javascript" src="../Public/script/distpicker.data.js"></script>
    <script type="text/javascript" src="../Public/script/distpicker.js"></script>
    <script type="text/javascript" src="../Public/script/DateTimePicker.js"></script>
    <script type="text/javascript" src="../Public/script/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="../Public/layer/layer.js"></script>
    <script type="text/javascript" src="../Public/script/jquery.uploadify.min.js"></script>

    <link type="text/css" rel="stylesheet" href="../Public/script/uploadify.css">
    <style>
        .uploadify-button {
            background: url(../Public/images/个人中心-设计师申请_+.png) no-repeat;
            padding-top: 80px;
            border: 1px solid #fff;
            display: block;
            border-radius: 0px;

        }

        .uploadify:hover .uploadify-button {
            background: url(../Public/images/个人中心-设计师申请_+.png) no-repeat;
            padding-top: 70px;

        }

        .uploadify-queue {
            display: none;
        }
    </style>
    <style>

        .current {
            padding: 4px 11px;
            background: #FFC904;
            color: #fff;
            border: 1px solid #e5e5e5;
            font-size: 15px
        }

        .num {
            background:;
            color: #009f8f;
            padding: 4px 11px;
            border: 1px solid #e5e5e5;
            font-size: 15px
        }

        .prev {
            border: 1px solid #e5e5e5;
            background:;
            color: #009f8f;
            font-size: 15px;
            padding: 4px 11px;
        }

        .next {
            border: 1px solid #e5e5e5;
            background:;
            color: #009f8f;
            font-size: 15px;
            padding: 4px 11px;
        }

        .ddd {
            border: 1px solid #e5e5e5;
            color: #009f8f;
            padding: 4px 11px;
            font-size: 15px
        }

        .seling {
            background: #49bf9d
        }

    </style>

</head>

<body>

<include file="Common:header"/>

<!--contain-->
<div class="contain">

    <div class="groupCont" style="background-color: #eeeeee;">
        <div class="gcBlank"></div>
         <input class="session" type="hidden" value="{$_SESSION['userr']}">
        <div class="widthBlock">
            <if condition=" $_SESSION['zhuangtai'] eq 1">
                <div class="gcTitle">
                    我要晒图
                </div>

                <form name="form1" method="post" action="{:U('Quanzi/fabu')}" enctype="multipart/form-data"
                      onsubmit=" return checkee()">
                    <div class="form">
                        <div class="inputBlock">
                            <div class="name fl">
                                标题
                            </div>
                            <div class="input fl">
                                <input type="text" name="title">
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="inputBlock">
                            <div class="name fl">
                                内容
                            </div>
                            <div class="input fl">
                                <textarea name="content"></textarea>
                            </div>
                            <div class="clear"></div>
                        </div>
                        <div class="imgBlock">

                            <div id="img"></div>
  <div class="clear"></div>

                            <input id="file_upload" name="file_upload" type="file" width="0" multiple="true" value=""/>


                        </div>
                        <div class="clear"></div>

                        <div class="btn">
                            <button type="submit">发布</button>
                        </div>
                    </div>
                </form>
            </if>
            <form action="" method="post" style="    padding-top: 60px;
    padding-bottom: 30px;" >
                {$quanzi}
            </form>

            <!-- <volist name="quanzi" id='vo'>
            <div class="groupList">
                <div class="li">
                    <div class="user fl">
                        <img src="../Public/uploadfile/images/user_img02.jpg">
                        <p>{$vo.username}</p>
                    </div>
                    <div class="other fr">
                        <div class="p1">
                            <h1><a href="group_detail.html">{$vo.title}</a> <a class="favour" href="javascript:;"></a></h1>
                            <p><a href="group_detail.html">{$vo.content}</a></p>

                            <div class="imgs">
                            <volist name='vo.img' id="img">
                                <img src="Uploads/{$img}">
                                     </volist>
                            </div>

                            <div class="btn">
                                <span class="fl">{$vo.time|date='Y-m-d H:i',###}</span>
                                <a href="#"><img src="../Public/images/group_icon02.png">赞（878）</a>
                                <a><img src="../Public/images/group_icon03.png">评论（5）</a>
                                <a href="#"><img src="../Public/images/group_icon04.png">转发</a>
                            </div>
                        </div>
                        <div class="p2">
                            <ul>
                                <li>
                                    <div class="img fl">
                                        <img src="../Public/uploadfile/images/user_img02.jpg">
                                    </div>
                                    <div class="text fr">
                                        <h1>小桂花的春天</h1>
                                        <p>欧式风格的底色大多采用白色、淡色为主，家具则是白色或深色都可以，但是要成系列，风格统一。同时，一些布艺的面料和质感很重要，比如丝质面料是会显得比较高贵的。</p>
                                        <h2>2017-01-10 12:34</h2>
                                    </div>
                                    <div class="clear"></div>
                                </li>

                            </ul>
                            <div class="submit">
                                <input type="text" placeholder="发表评论"><button type="submit">发送</button>
                            </div>
                        </div>
                        <div class="cornor"><img src="../Public/images/cornor.png"></div>
                    </div>
                    <div class="clear"></div>
                </div>

            </div>
            </volist> -->
        </div>
    </div>

</div>
<!--contain end-->
<!-- <div class="clear"> -->
<!--bottom2-->
<div class="bottom2Blank"></div>
<input type="hidden" value="5" id="xianzhi">
<div class="bottom2">
    <div class="widthBlock">

        <!--Pages-->
        <div class="pages">
            <div style="text-align: center;">{$page}</div>

        </div>
        <!--Pages-->

    </div>
</div>
<!--bottom2 end-->

<include file="Common:footer"/>


<script>
    jQuery(document).ready(function (e) {

        $(".favour").click(function () {

 if ($('.session').val()=='') {
    layer.alert('请登录后收藏');
  }else{


            if ($(this).hasClass("checked")) {
                $(this).removeClass("checked");

 var id= $(this).attr('data-id');

            $.ajax({
                  url:'{:U("User/quanzi1")}',
                  type:'post',
                  data:{
                      quanzi:id
                  },
                  success:function(data){
                  if(data==1){

                    layer.msg('取消收藏',{time: 1000,});
                  }

  
                  }



            })

            }


            else {
                $(this).addClass("checked");
                
            var id= $(this).attr('data-id');
            $.ajax({
                  url:'{:U("User/quanzi1")}',
                  type:'post',
                  data:{
                      quanzi:id
                  },
                  success:function(data){
                  if(data==1){

                    layer.msg('收藏成功',{time: 1000,});
                  }


                  }



            })





            }}
        });


    });

    $(function () {

        var img_id_upload = new Array();
        var i = 0;

        $('#file_upload').uploadify({
            'swf': '../Public/script/uploadify.swf',
            'method': 'post',
            'uploader': '{:U("Quanzi/tupian")}',
            'buttonText': '',
            'rollover': true,
            'multi': true,
            'height': 70,
            'uploadLimit': 5,
            'fileSizeLimit': "2MB",
// 'buttonText':"图片上传",
'fileTypeExts'  :   '*.gif;*.jpg;*.png;*.bmp',
            'fileDesc': '不超过2M的图片 (*.gif;*.jpg;*.png)',
        'overrideEvents': ['onSelectError', 'onDialogClose'],
        //返回一个错误，选择文件的时候触发
        'onSelectError': function (file, errorCode, errorMsg) {
            switch (errorCode) {
                case -100:
                    layer.alert("上传的文件数量最多5张！");
                    break;
                case -110:
                    layer.alert("文件 大小超出系统限制的" + $('#file_upload').uploadify('settings', 'fileSizeLimit') + "大小！");
                    break;
                case -120:
                    alert("文件  大小异常！");
                    break;
                case -130:
                    alert("文件  类型不正确！");
                    break;
            }
            return false;
        },



            'onUploadSuccess': function (file, data, response) {
                  var html=' <li style="list-style:none; float:left"><input  name="photos[]" type="hidden" width="0" multiple="true" value="' + data + '" /><img  style="width:111px; "  src="Uploads/' + data + '" width="141" height="130" border="0" /><div class="del" style="position: relative;top: -99px;right: -100px; font-size:24px"><div style="    top: 0;right: 0px;width: 11px;border-radius: 15px;background-color: #49bf9d;cursor: pointer;padding: 1px; " onclick="dianji(this)" >x</div></div></li>';
                $('#img').append(html);

                img_id_upload[i] = data;
                i++;


            },
        });
        // //图二
        //  $('#file_upload2').uploadify({
        //     'swf'      : '../Public/script/uploadify.swf',
        //      'method'   : 'post',
        //     'uploader' : '{:U("Quanzi/tupian")}',

        //     'buttonText' : '图片二上传',
        //     'onUploadSuccess' : function(file, data, response) {


        //         $('#img2').attr('src','Uploads/'+ data);
        //         $('#images2').val(data);
        //     },
        // });
    });


</script>
<script>
    function checkee() {
        if (document.form1.title.value == "") {
            layer.alert('请输入标题');
            document.form1.title.focus();
            return false;
        }

        if (document.form1.content.value == "") {
            layer.alert('请输入内容');
            document.form1.content.focus();
            return false;
        }
        if (!$('#img').find('div').hasClass('del')) {
                        layer.alert('请上传图片');
                                    return false;
        }
    }


    function aaa(parm, obj) {
        var content = "";
        var p = obj.parentNode.children;
        for (var i = 0, pl = p.length; i < pl; i++) {
            if (p[i].name = "content") {
                content = p[i].value;
                break;
            }
        }

        if (content == "" || content == undefined) {
            layer.alert("请输入评论内容");
            return;
        }


        $.ajax({
            url: 'index.php?m=Home&c=Quanzi&a=spid',
            data: {
                'content': content,
                'pid': parm
            },
            type: 'post',
            dataType: 'json',
            success: function (data) {

                if (data == 1) {
                    layer.alert('发布成功', {
                        time: 8000, //2s后自动关闭
                        btn: ['确定']
                    });
                    // layer.alert("发布成功");
                    window.location.href = "{:U('quanzi/index')}";
                } else if (data == 0) {
                    layer.alert("发布失败");
                } else if (data == 3) {
                    layer.alert('请登录后发布', {
                        btn: ['确定']
                    });
                    // var b = layer.alert("请登录后发布");
                    // alert(b);

                }


            }

        });


    }

    function zan(parm) {
        var id = parm;
        $.ajax({
            url: 'index.php?m=Home&c=Quanzi&a=zan',
            data: {
                'id': parm
            },
            type: 'post',
            dataType: 'json',

            success: function (data) {
                if (data == 1) {
                    window.location.href = "{:U('quanzi/index')}";
                }


            }

        });
    }
        
        function redirect(id) {
            var val =id;
          //  console.log(id);
            location.href="index.php?m=Home&c=Quanzi&a=details&id="+val;
        }


function dianji(obj){
 $(obj).parent().parent().remove();
 var uploadLimit=parseInt($("#xianzhi").val());

$('#file_upload').uploadify('settings','uploadLimit', ++uploadLimit);
$("#xianzhi").val(uploadLimit);
}


</script>


<script type="text/javascript">document.getElementById("menu4").className = "curr";</script>
</body>
</html>
